/*
 * RTS.c
 *
 *  Created on: Jan 20, 2014
 *      Author: adijoshi
 */

#include "includes.h"

/*
 * Function: func_RTS
 *
 * Inputs:	 Mnemonic, Address_of_source, Address_of_destination
 * Outputs:  Result

Condition Codes: None affected.

Description:
				(reg) -> (PC)
				pop contents of stack into reg

loads  the contents  of  the  reg  into  the  PC  and
pops  the  top  element  of  the  processor stack  into  the  specified  register.
*/

void func_RTS(unsigned short register_address)
{
	unsigned short register_data;

	register_data = read_from_memory(register_address,DATA);
	set_Program_Counter(register_data);

	write_in_memory(register_address,pop(),DATA);
}

